#include<bits/stdc++.h>
using namespace std;
struct Tuple{
	int x,y,z;
};
vector <Tuple> v;
int main()
{
	freopen("road.in","r",stdin);
	freopen("road.out","w",stdout);  
	int n;
	cin>>n;
	int tt = log(n) / log(2) + 1;
	for(int i = 2;i <= tt - 1;i++) v.push_back((Tuple){i - 1,i,0}),v.push_back((Tuple){i - 1,i,1 << (tt - i)});
	v.push_back((Tuple){tt - 1,114,0});v.push_back((Tuple){tt - 1,114,1});
	for(int i = tt - 2,j = 0;i >= 1;i--)
	{
		j |= (1 << (i + 1)); 
		if(!((n >> i) & 1)) continue; 
		v.push_back((Tuple){1,tt - i,n & j});
	}
	if(n & 1) v.push_back((Tuple){1,114,n - 1});
	v.push_back((Tuple){1,114,n});
	cout<<tt<<" "<<v.size()<<endl;
	for(auto now : v) cout<<now.x<<" "<<now.y<<" "<<now.z<<endl;
	return 0;
}
